﻿using System;
using System.Collections.Generic;
using System.Text;
using Water.Architecture2.Model;
using Water.Resources.Globalize;

namespace Water.Architecture2.EntityXML
{
    internal static class EntityMappingContainer
    {
        private static Dictionary<string, EntityMapping> entityMappings = new Dictionary<string, EntityMapping>();

        
        //internal static Dictionary<string, EntityMapping> EntityMappings
        //{
        //    get { return EntityMappingContainer.entityMappings; }
        //    set { EntityMappingContainer.entityMappings = value; }
        //}
        
        internal static void Add(string key,EntityMapping entityMapping)
        {
            if (entityMappings.ContainsKey(key))
                EntityMappingContainer.entityMappings.Remove(key);
            EntityMappingContainer.entityMappings.Add(key, entityMapping);
        }

        internal static EntityMapping Get(string key)
        {
            if (entityMappings.ContainsKey(key))
                return EntityMappingContainer.entityMappings[key];
            else
                throw new Exception(string.Format(ExceptionResource.ExceptionEntityNotFound,key));
        }
        internal static Dictionary<string, EntityMapping> EntityMappings
        {
            get { return entityMappings; }
        }
    }
}
